package com.szf.account.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.szf.account.entity.Account;
import com.szf.base.service.BaseService;
import com.szf.util.StringUtil;

@Service
public class AccountService extends BaseService {

	public Account findByName(String userName) {
		return hibernateDao.findDistinctBy(Account.class, "userName", userName);
	}

	public Account findById(String accountId) {
		return hibernateDao.get(Account.class, accountId);
	}

	public void save(Account account) {
		super.hibernateDao.saveOrUpdate(account);
	}
	
	public void deleteAccount(String ids) {
		if (StringUtil.isEmpty(ids)) {
			return;
		}
		String inIds = StringUtil.getInString(ids);
		Map<String, String> param = new HashMap<String, String>();
		param.put("ids", inIds);
		super.ibatisDao.delete("sinlog.deleteAccount", param);
	}
}
